package donnee;

public class Revue {
	private String id;
	private String bierre;
	private int[] contents;
	private int[] note;

	public Revue(String id, int[] content, int[] note) {
		this.id = id;
		this.contents = content;
		this.note = note;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getBierre() {
		return bierre;
	}

	public void setBierre(String bierre) {
		this.bierre = bierre;
	}

	public int[] getContent() {
		return contents;
	}

	public void setContent(int[] contents) {
		this.contents = contents;
	}

	public int[] getNote() {
		return note;
	}

	public void setNote(int[] note) {
		this.note = note;
	}

	@Override
	public String toString() {
		StringBuilder s = new StringBuilder();

		s.append(id);
		s.append(" ");
		s.append(bierre);
		s.append(" {");
		for (int i : contents) {
			s.append(i);
			s.append(", ");
		}
		s.append("} [");
		for (int i : note) {
			s.append(i);
			s.append(", ");
		}
		s.append("]");

		return s.toString();
	}

	public int similaireMajorite(Revue b) {
		int somme = 0;
		for (int i = 0; i < note.length; i++) {
			int j = b.getNote()[i];
			if (i == j)
				somme += 1;
		}

		return somme;
	}

}
